const mongoose = require('mongoose');
let Accountchema = new mongoose.Schema({
  creationTime: {//创建时间 毫秒
    type: Number,
    default: new Date()
  },
  recordingTime: {//记录时间 毫秒
    type: Number,
    default: new Date()
  },
  type: {  //录入类型 //1支出 2收入
    type: Number,
    enum: [1, 2],
  },
  catalogueType: { //录入类目
    type: Number,
    required: true,
  },
  catalogueName: { //类目名称
    type: String,
    required: true,
  },
  catalogueIcon: { //类目icon
    type: String, 
    required: true,
  },
  money: {//录入金额
    type: Number,
    required: true,
  },
  remark: {//备注
    type: String || Null,
    default: null,
  },
  userId: {//用户id
    type: String || Null,
    default: null,
  },
});
// 6.创建模型对象
let AccountModel = mongoose.model('books', Accountchema);

module.exports = AccountModel
